<template>
	<view class="content">
		<image v-bind:class="className" src="/static/icons/logo.png"></image>
		<view class="text-area">
			<text class="title" v-on:click="open">{{title}}</text>
		</view>
		<view>
			<view>{{ number + 1 }}</view>
			<viw>{{ ok ? 'YES' : 'NO'}}</viw>
			<view>{{ message.split('').reverse().join('') }}</view>
			
		</view>
		
		
		<view v-for="item in arr" style="color:#ff0000;">
			{{item}}
		</view>
		<view v-for="(item,index) in 6" style="color:#00ffff;">
			<view :class="'list-' + index%2">{{index +2}}</view>
		</view>
		
		<view v-for="(value,name,index) in object">
			{{ index  }}---{{name}}---{{value}}
		</view>
		
		<view v-for="item in arr" :key="item.id">
			<view style="color: #333300;">{{item.id}}:{{item.name}}</view>
		</view>
		<view v-bind:class="className2" @click="handleChange">
			
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:'Hello UniAPP',
				className:"small",
				className2:"small",
				number: 1,
				ok: true,
				message: 'Hello Vue!',
				
				arr:[
					{id:1,name:'uni-app'},
					{id:2,name:'HTML'},
					{id:3,name:'wechat'},
					{id:4,name:'Android'}
				],
				object:{
					title:'How to do lists in vue',
					author:'Jane Doe',
					publishedAt: '2020-04-10'
				}
			}
		},
		methods: {
			open() {
				this.title = "openning a New Page";
				this.className = 'logo'
			},
			handleChange(){
				console.log("handleChange---ok:"+ this.ok);
				
				if(this.ok){
					this.ok = false;
					this.className2 = "big"
				} else{
					this.ok = true;
					this.className2 = "small"
				}
				
			}
			
		}
	}
</script>

<style>
	.small{
		background-color: #ff0000;
		height: 100px;
		width: 100px;
		
	}
	.big{
		background-color: aqua;
		width: 200px;
		height: 300px;
	}
	.content {
			text-align: center; /* 核心：让所有子元素文字居中 */
		}
		.list-1{
			color: black;
		}
		
	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
		display: block;
	}
	.smalllogo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
		display: block;
	}
</style>
